package com.eascs.workflow.common.service.sys;

import java.util.List;

import com.eascs.app.dao.PageResult;
import com.eascs.web.sso.User;
import com.eascs.workflow.common.entity.sys.ActOrgDetail;
import com.eascs.workflow.common.entity.sys.ActOrgEntity;
import com.eascs.workflow.common.entity.sys.ActOrgUser;
import com.eascs.workflow.common.entity.sys.PlatformRegional;
import com.eascs.workflow.common.entity.sys.SysUser;
import com.eascs.workflow.common.vo.ModelResult;
import com.eascs.workflow.common.vo.OrgUserVO;

public interface SysOrgService {

	public List<ActOrgEntity> getOrgListByLevel(String parentId, int level);

	public List<ActOrgEntity> getOrgByParentIdAndLevel(String parentId, int level);

	public List<ActOrgEntity> getOrgProvince();

	/**
	 * 组织架构联想查询，level若为空则查询所有层级
	 * 
	 * @param orgName
	 * @param level
	 *            组织机构层级
	 * @return
	 */
	public ModelResult<List<Object[]>> getOrgListLikeName(String orgName, Integer level, User loginUser);

	public ModelResult<List<Object[]>> getOrgListLikeNameWithLevels(String orgName, List<Integer> levelList,
			User loginUser);

	public List<Object[]> getOrgAllLikeName(String orgName);

	public List<ActOrgEntity> getOrgAllList();

	public ActOrgEntity getOrgByIds(String ids);

	public ActOrgEntity getOrgByUnitNo(String unitNo);

	public ActOrgEntity insert(ActOrgEntity orgEntity);

	public int update(ActOrgEntity orgEntity);

	public int delete(String ids);

	public ActOrgDetail getOrgDetailByUnitCode(String unitCode);

	public ActOrgDetail getOrgDetailByUnitNo(String unitNo);

	public List<ActOrgEntity> getChildOrgByUnitNo(String unitNo);

	public List<ActOrgEntity> getChildOrgByName(String name);

	public ModelResult<PageResult<OrgUserVO>> queryPageActOrgUser(String orgId, int pageSize, int pageIndex);

	public ModelResult<Integer> insertActOrgUser(ActOrgUser actOrgUser);

	public ModelResult<Integer> deleteActOrgUser(String id, String userNo);

	/**
	 * 查询用户所在的子机构
	 * 
	 * @param unitNo
	 * @return
	 */
	public List<ActOrgEntity> getChildOrgByOrgId(String orgId);

	/**
	 * 查询用户和组织关系
	 * 
	 * @param userNo
	 * @return
	 */
	public ModelResult<ActOrgUser> getOrgUserByUserNo(String userNo);

	/**
	 * 查询用户所属组织机构
	 * 
	 * @param userNo
	 * @return
	 */
	public ModelResult<ActOrgEntity> getActOrgByUserNo(String userNo);

	/**
	 * 查询所有父级组织机构
	 * 
	 * @param orgId
	 * @return
	 */
	public ModelResult<List<ActOrgEntity>> getAllOrgParentList(String orgId);

	/**
	 * 关联用户和角色查询用户所属组织机构（act_org_role_user和act_org_user）
	 * 
	 * @param userNo
	 * @return
	 */
	public ModelResult<List<ActOrgEntity>> getOrgListByRoleAndUser(String userNo);

	public List<ActOrgEntity> getOrgChildrenByOrgId(String orgId);

	/**
	 * 通过平台unito查找对应省区
	 */
	public ActOrgEntity getProvincialByOrgUnito(String unito);

	/**
	 * 获取区域列表
	 * 
	 * @return
	 */
	public ModelResult<List<PlatformRegional>> getPlatformRegionalList();

	/**
	 * 获取人员下的省份
	 * 
	 * @param userNo
	 * @return
	 */
	public ModelResult<List<ActOrgEntity>> getProvinceWithUser(String userNo);

	/**
	 * 获取人员下的信贷经理
	 * 
	 * @param userNo
	 * @return
	 */
	public ModelResult<List<SysUser>> getCreditMGRWithUser(String userNo);

	public ModelResult<List<SysUser>> getCreditMGRAndMarketerWithUser(String userNo);

	/**
	 * 获取人员下的经营平台
	 * 
	 * @param userNo
	 * @return
	 */
	public ModelResult<List<ActOrgEntity>> getPlatformWithUser(String userNo);

	public ModelResult<ActOrgEntity> getUniquePlatformWithUser(String userNo);

	public List<ActOrgEntity> getLeafNodeByParentId(String orgId);

	public String getProvinceLetterCode(String provinceCode);

	/**
	 * 检查数据权限
	 * 
	 * @param userNo
	 * @return
	 */
	public List<User> checkDataPermission(String userNo);
}
